Skip to content

Instantly share code, notes, and snippets.

@marcoblos
marcoblos / login-without-password-and-without-copy-key-to-server.md
Created May 26, 2019 05:42
Step by step: create a pem file to login without password and without copy local keys to remote server. SSH authentication like AWS EC2.
  1. Login with account user (not root)
mkdir pem
cd pem
ssh-keygen -b 2048 -f identity -t rsa
  1. Copy public key contents to authorized_keys
@simply-coded
simply-coded / OnTopNotepad.ps1
Last active May 11, 2024 06:07
An always on top notepad for taking notes and such.
# makes a notepad process that remains on top of other windows.
$cs = Add-Type -MemberDefinition '
[DllImport("user32.dll")] public static extern bool SetWindowPos(IntPtr a, IntPtr b, int c, int d, int e, int f, uint g);
public static void AlwaysOnTop(IntPtr a, int d) { SetWindowPos(a, (IntPtr)(-1), 0, d-250, 300, 200, 64); }
' -Name PS -PassThru;
$hWnd = Start-Process -FilePath notepad -PassThru;
$screen = Get-WmiObject -Class Win32_VideoController | Select-Object CurrentVerticalResolution;
$cs::AlwaysOnTop($hWnd.MainWindowHandle, $screen.CurrentVerticalResolution);
@simply-coded
simply-coded / CreateExcelFile.vbs
Last active May 11, 2024 06:06
Use VBScript to create, open, and edit excel files. ( Excel needs to be installed on your computer ).
'Microsoft Excel Automation Basics
':: Create and edit an Excel File.
'---------------------------------
'create the excel object
Set objExcel = CreateObject("Excel.Application")
'view the excel program and file, set to false to hide the whole process
objExcel.Visible = True
@matthewzring
matthewzring / markdown-text-101.md
Last active May 11, 2024 06:04
A guide to Markdown on Discord.

Markdown Text 101

Want to inject some flavor into your everyday text chat? You're in luck! Discord uses Markdown, a simple plain text formatting system that'll help you make your sentences stand out. Here's how to do it! Just add a few characters before & after your desired text to change your text! I'll show you some examples...

What this guide covers:

using System;
using System.Collections.Generic;
using System.Data;
using OfficeOpenXml;
namespace ExcelExport
{
internal class DataTableExcelExporter
{
private readonly IEnumerable<string> _columnsToHide;
@pesterhazy
pesterhazy / indexeddb-problems.md
Last active May 11, 2024 06:03
The pain and anguish of using IndexedDB: problems, bugs and oddities

This gist lists challenges you run into when building offline-first applications based on IndexedDB, including open-source libraries like Firebase, pouchdb and AWS amplify (more).

Note that some of the following issues affect only Safari. Out of the major browsers, Chrome's IndexedDB implementation is the best.

Backing file on disk (WAL file) keeps growing (Safari)

When this bug occurs, every time you use the indexeddb, the WAL file grows. Garbage collection doesn't seem to be working, so after a while, you end up with gigabytes of data.

Random exceptions when working with a large number of indexeddb databases (Safari)

import time
import os
import logging
import random
from datasets import load_dataset
class QuantAutoGPTQ:
def __init__(self, model_name_or_path, output_dir, dataset,
num_samples=128, trust_remote_code=False, cache_examples=True,
use_fast=True, use_triton=False, bits=[4], group_size=[128], damp=[0.01],
@kennypete
kennypete / navigating_the_modes_of_Vim.md
Created April 18, 2024 20:46
Navigating the modes of Vim

Navigating the modes of Vim

This diagram illustrates navigating through Vim’s modes. It was built factoring Vim 9 (i.e., all its modes, including up to two new modes, cr and cvr, in November 2023). Information about the state() and 'showmode' is provided too.

SVG version

Some features are only available in the SVG version. It is not provided directly from within this gist’s files because SVGs do not always play nicely in GitHub (particularly, refusing to display embedded fonts).

The SVG version includes hover text help, which shows pertinent information about the underlying key, command, mode, etc.

#None of this will work through an already open excel application
#You must open Excel and workbooks you want to manipulate via the COMobject
####################################################
############### Starting Excel #####################
####################################################
$Excel = New-Object -ComObject Excel.Application
$Excel.Visible = $true
using System;
using System.Collections.Generic;
using log4net;
using Excel = Microsoft.Office.Interop.Excel;
public class ExcelUtility
{
private static ILog objLogger = LogManager.GetLogger("ExcelUtility");
#region Métodos